#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int, int>
#define pil pair<int, ll>
#define pli pair<ll, int>
#define pll pair<ll, ll>

void solve1(){
    int n;
    cin >> n;
    vector<int> a(n);
    ll mn, mx;
    for(int i = 0; i < n; i++){
    	cin >> a[i];
    	if(a[i] == 1) mn = i;
    	if(a[i] == n) mx = i;
    }
    if(mn > mx) cout << 0 << '\n';
    else cout << 1 << '\n';
}

ll ask(ll l, ll r){
	cout << "? " << l << ' ' << r << '\n';
	cout.flush();
	ll num;
	cin >> num;
	return num;
}

void solve2(){
	ll n, x;
	cin >> n >> x;
	ll l = 1, r = n, res = -1, res1 = -1;
	while(l <= r){
		ll mid = (l + r) >> 1;
		if(ask(1, mid) == n - 1){
			r = mid - 1;
			res = mid;
		}else{
			l = mid + 1;
		}
	}
	cout << res << '\n';
	l = 1, r = res;
	while(l <= r){
		ll mid = (l + r) >> 1;
		if(ask(mid, res) == n - 1){
			l = mid + 1;
			res1 = mid;
		}else{
			r = mid - 1;
		}
	}
	if(x){
		cout << "! " << res << '\n';
		cout.flush();
 	}else{
 		cout << "! " << res1 << '\n';
		cout.flush();
 	}

}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    string s;
    cin >> s;

	int _;
	cin >> _;
    if(s == "first"){
    	while(_--){
    		solve1();
    	}
    }else{
    	while(_--){
    		solve2();
    	}
    }

    return 0;
}